package com.dao.impl;

import com.dao.OrderItemDao;
import com.javabean.Order;
import com.javabean.OrderItem;

import java.util.List;

public class OrderItemDaoImpl extends BaseDao implements OrderItemDao {
    @Override
    public int saveOrderItem(OrderItem orderItem) {
        String sql = "insert into t_order_item(`name`,`count`,`price`,`totalprice`,`orderid`) values(?,?,?,?,?)";
        return update(sql, orderItem.getName(), orderItem.getCount(), orderItem.getPrice(), orderItem.getTotalprice(), orderItem.getOrderId());

    }

    @Override
    public List<OrderItem> queryOrderItemsByOrderId(String orderid) {
        String sql = "select  * from t_order_item where orderid=?";
        return queryForList(OrderItem.class, sql, orderid);
    }
}
